import 'package:shared_preferences/shared_preferences.dart';

enum PUBLISH_MODE{
    PUBLISH_MODE_release,//发布
    PUBLISH_MODE_debug,//测试
}

class Address{
 static PUBLISH_MODE  publish_mode = PUBLISH_MODE.PUBLISH_MODE_release;
// PUBLISH_MODE   publish_mode;
 static String BASE_URL = null;
 static String TEST_API ="";


 static String YxArea_API_release = 'http://www.czbanbantong.com/get_yx_area.php' ;
 static String YxArea_API_debug = 'http://192.168.148.85/get_yx_area.php' ;
 static String YxArea_API =  publish_mode == PUBLISH_MODE.PUBLISH_MODE_release ?  YxArea_API_release : YxArea_API_debug ;


 static String url_get_dns_release  ="http://www.czbanbantong.com/get_yx_url.php";
 static String url_get_dns_debug ="http://192.168.148.85/get_yx_url.php";

 static String url_get_dns =  publish_mode == PUBLISH_MODE.PUBLISH_MODE_release ?  url_get_dns_release : url_get_dns_debug ;

/**********************地址字符串拼接***************************************/


 static Future <String>  getRequestUrl(String dnsKey,String extendUrl) async{
  SharedPreferences prefs = await SharedPreferences.getInstance();
  String  dnsStr =   prefs.getString(dnsKey);
  print('dnsStr-------------------$dnsStr');
  return  dnsStr + extendUrl;

 }



 static  String relationAccount_extendUrl = "/uxinApi/v1.0/user/hasRelationAccount";//获取关联账号
 static  final   url_get_RelationAccount =  Address.getRequestUrl('areaDNS_api_url',relationAccount_extendUrl);

 static  String KLoginForUxin_extendUrl = "/uxinApi/v1.0/user/loginForUxin";//登录
 static  final   url_get_LoginForUxin =  Address.getRequestUrl('areaDNS_api_url',KLoginForUxin_extendUrl);


 /***********************通讯录更新
  *  学生 家长
  * 获取自身的详细信息->获取家长通讯录(清空数据库)->获取群组列表 -> 通讯录更新成功 ->更改更新标示
  *
  * 教师
  *获取自身的详细信息->获取教师通讯录(清空数据库)->获取群组列表 ->获取公共通讯录 ->通讯录更新成功 ->更改更新标示
  *
  * **************************************************************************/

 static  String userProfile_extendUrl = "/user/profile"; // 获取自身的详细信息
 static  final   url_get_userProfile =  Address.getRequestUrl('areaDNS_api_url',userProfile_extendUrl);


 static  String  getAllUserProfile_extendUrl = "/user/getAllUserProfile"; //获取公共通讯录
 static  final   url_get_getAllUserProfile =  Address.getRequestUrl('areaDNS_api_url',getAllUserProfile_extendUrl);


 static  String  getGroupsForTeacher_extendUrl = "/group/getGroupsForTeacher"; // 获取教师通讯录
 static  final   url_get_groupsForTeacher =  Address.getRequestUrl('areaDNS_api_url',getGroupsForTeacher_extendUrl);

 static  String  getGroupsForParent_extendUrl = "/group/getGroupsForParent"; // 获取家长通讯录
 static  final   url_get_groupsForParent =  Address.getRequestUrl('areaDNS_api_url',getGroupsForParent_extendUrl);


 static  String  getJoinedGroups_extendUrl = "/group/joinedGroups";   //获取群组列表
 static  final   url_get_joinedGroups=  Address.getRequestUrl('areaDNS_api_url',getJoinedGroups_extendUrl);

 static  String  getUpdateTheFlagToFalse_extendUrl = "/addressbook/updateTheFlagToFalse";   //更改更新标示
 static  final   url_get_updateTheFlagToFalse=  Address.getRequestUrl('areaDNS_api_url',getUpdateTheFlagToFalse_extendUrl);



}



